<!DOCTYPE html>
<html>

<head>
  <meta charset=utf-8>
  <style type="text/css">
    #rect {
      width: 120px;
      height: 100px;
      background-color: black;
      /*补全代码*/
      /* animation: name duration timing-function delay iteration-count direction fill-mode; */
  
    }

    @keyframes rect {
      from {
        transform: rotate(0deg);
      }

      to {
        transform: rotate(360deg);
      }
    }
  </style>
</head>

<body>
  <!-- 
        描述
请补全代码，要求当滑动id为"range"的滑块控件时可以改变id为"rect"的矩形旋转速度。要求如下：
1. id为"rect"的矩形初始动画周期为10秒
2. id为"range"的滑块控件默认值为1、最小值为、最大值为10、滑动间隔为1
3. 当滑动滑块值为1时，矩形动画周期为10秒、当...，为...、当滑动滑块值为10时，矩形动画周期为1秒
注意：
1. 必须使用DOM0级标准事件（onchange）
       -->
  <!-- 补全代码 -->
  <div id="rect"></div>
  <input id="range" />

  <script type="text/javascript">
    // 补全代码
    const divEl = document.querySelector('#rect')
    const inputEl = document.querySelector('#range')

    inputEl.onchange = function() {
      console.log(this.value)
      if(this.value == 1) {
        divEl.style.animationName = 'rect'
        divEl.style.animationDuration = '10s'
      }
      if(this.value == 2) {
        divEl.style.animationName = 'rect'
        divEl.style.animationDuration = '9s'
      }
      if(this.value == 3) {
        divEl.style.animationName = 'rect'
        divEl.style.animationDuration = '8s'
      }
      if(this.value == 4) {
        divEl.style.animationName = 'rect'
        divEl.style.animationDuration = '7s'
      }
      if(this.value == 5) {
        divEl.style.animationName = 'rect'
        divEl.style.animationDuration = '6s'
      }
      if(this.value == 6) {
        divEl.style.animationName = 'rect'
        divEl.style.animationDuration = '5s'
      }
      if(this.value == 7) {
        divEl.style.animationName = 'rect'
        divEl.style.animationDuration = '4s'
      }
      if(this.value == 8) {
        divEl.style.animationName = 'rect'
        divEl.style.animationDuration = '3s'
      }
      if(this.value == 9) {
        divEl.style.animationName = 'rect'
        divEl.style.animationDuration = '2s'
      }
      if(this.value == 10) {
        divEl.style.animationName = 'rect'
        divEl.style.animationDuration = '1s'
      }
    }
  </script>
</body>

</html>